<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!-- 这个是头部导航栏 -->
<header th:flagments="header">
	<nav class="navbar navbar-default" role="navigation" style="background-color: white">
		<div class="container-fluid" style="margin-left: 10%">
			<div class="navbar-header">
				<a class="navbar-brand" href="">逍遥论坛</a>
			</div>
			<div>
				<!--向左对齐-->
				<ul class="nav navbar-nav navbar-left">
					<!-- <li th:if="${tab.tabName == '技术'}" class="active"> -->
					<a href="#">技术</a>
					</li>
				</ul>
				<!--未登录-->
				<ul class="nav navbar-nav navbar-right" th:if="${session.USER==null}">
					<li>
						<p class="navbar-text">
							<a href="toLoginPage.do">登录</a>
						</p>
					</li>
					<li>
						<p class="navbar-text">
							<a href="toSignUpPage.do">注册</a>
						</p>
					</li>
				</ul>
				<!--已登录-->
				<ul class="nav navbar-nav navbar-right" th:if="${session.USER!=null}">
					<li>
						<p class="navbar-text">
							<a href="toMainPage.do">首页</a>
						</p>
					</li>
					<!-- 被锁定的用户不能发贴 -->
					<li th:if="${session.USER.userStatus != 2}">
						<p class="navbar-text">
							<a href="toPublishTip.do">发表新贴</a>
						</p>
					</li>
					<li>
						<p class="navbar-text">
							<a th:href="${'getUserInfo.do?userId='+session.USER.userId}">
								<span th:switch="${ session.USER.userNick==null}">
									<span th:case="true"><span th:text="${session.USER.userName}"></span></span>
									<span th:case="false"><span th:text="${session.USER.userNick}"></span></span>
								</span>

							</a>
						</p>
					</li>

					<!-- 显示管理员功能下拉栏 -->
					<li class="dropdown" open th:if="${session.USER.userType == 0 || session.USER.userType == 1}">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
							aria-expanded="true"> 管理员功能
						</a>
					</li>
					<ul class="dropdown-menu">
						<div th:if="${session.USER.userType == 0}">
							<!-- 超级管理员可以注册新管理员 -->
							<li><a th:href="toSignUpPage.do">注册新的管理员</a></li>
							<li role="separator" class="divider"></li>
						</div>
						<li><a th:href="toUserManagePage.do">用户管理</a></li>
						<!-- 分割线 -->
						<li role="separator" class="divider"></li>
						<li><a th:href="toTipManagePage.do">贴子管理</a></li>
						<li role="separator" class="divider"></li>
						<li><a th:href="toForumManagePage.do">版块管理</a></li>
						<li role="separator" class="divider"></li>
						<li><a th:href="toTabManagePage.do">分类管理</a></li>
						<li role="separator" class="divider"></li>
					</ul>
					</li>
					<li>
						<p class="navbar-text">
							<a href="javascript:signOut_confirm();">退出登录</a>
						</p>
					</li>
				</ul>
			</div>
		</div>
	</nav>
	<script>
		function signOut_confirm() {
			var r = confirm("确定退出?")
			if (r == true) {
				window.location.href = "<%=basePath%>userSignOut.do";
			} else { }
		}
	</script>
</header>

</html>